<?php
print_r($_GET);
print_r($_POST);
echo "<hr>";
print_r($_FILES);
// 如果需要保存文件 ，那么你需要 把临时路径转成真实路径；
// 移动上传的文件
$path=$_FILES['img']['tmp_name'];
move_uploaded_file($path,"./uploads/".$_FILES['img']['name']);
//连接数据库
$link =  mysqli_connect("localhost","root","root","2113");

$username = $_POST['username'];
$pwd = $_POST['pwd'];
$imgUrl = "./uploads/".$_FILES['img']['name'];
$sql = "INSERT INTO users(username,pwd,imgUrl) VALUES('$username','$pwd','$imgUrl')";
$res = mysqli_query($link,$sql);
if($res){
	echo "添加成功";
}else{
	echo "添加失败";
}

?>